package com.andooco.dataq.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class CommonUtils {
    private static Random random = new Random();

    /**
     * 生成当前日期
     *
     * @return
     */
    public static String generateRequestDate() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        return sdf.format(new Date());
    }

    /**
     * 生成全局流水号
     *
     * @return
     */
    public static String generateTraceNo() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = sdf.format(new Date());
        int randomValue = random.nextInt(10000);
        return timestamp + randomValue;
    }
}
